package com.rms.hr.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.rms.hr.user.service.UserService;

/**
 * @author lgw0822
 *
 */
@Controller
@RequestMapping("/userController")
public class UserController {
	
	
	private UserService userService;
	
	@Autowired
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	@RequestMapping("/index")
	public ModelAndView index(){
		return new ModelAndView("index");
	}
	/**
	 * @return
	 */
	@RequestMapping("/getUserList")
	public ModelAndView getUserList(){
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("userList",this.userService.getAllUser());
		modelAndView.setViewName("page/hr/user/userList");
//		modelAndView.setViewName("redirect:/userList.jsp");

		return modelAndView;
	}
}
